# Contributor: Peter Shkenev <santurysim@gmail.com>
# Maintainer: Peter Shkenev <santurysim@gmail.com>
pkgname=zmusic
pkgver=1.1.9
pkgrel=0
pkgdesc="GZDoom's music system as a standalone library"
url="https://github.com/coelckers/ZMusic"
arch="all !ppc64le" # ftbfs
license="GPL-3.0-or-later AND LGPL-3.0-or-later AND LGPL-2.1-or-later AND custom"
makedepends="cmake fluidsynth-dev libsndfile-dev mpg123-dev alsa-lib-dev samurai"
subpackages="$pkgname-dev $pkgname-doc"
options="!check"    # No test suite
source="https://github.com/coelckers/ZMusic/archive/refs/tags/$pkgver/zmusic-$pkgver.tar.gz"
builddir="$srcdir/ZMusic-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	install -Dm644 licenses/dumb.txt "$pkgdir"/usr/share/licenses/$pkgname/dumb.txt
}



sha512sums="
8d1f5b16552c4f837c7a200da7205841d566ca786e0a8e38e748a866309e239069828d17b8084bd548fdaf524eb9b8b748ac4d0a28269a98f6eaa9c8eca504c9  zmusic-1.1.9.tar.gz
"
